package edu.byu.intex2.data.dao;

import edu.byu.intex2.data.dao.*;

/*******************************************************************************
 *
 *        @author Adam
 *          Date: Mar 3, 2009
 *   Description:
 * Last Revision: Mar 3, 2009
 *
 ******************************************************************************/

public class Technician extends Employee{

    private String servicefacilityid = null;
    private ServiceFacility servicefacility = null;

    /** Creates a new instance of the BO */
    public Technician(String id) {
      super(id);
    }

    /** Convenience method to call the correct DAO to save this business object */
    public void save() throws DataException {
      TechnicianDAO.getInstance().save(this);
    }

    /** Returns a string representation of the object */
    public String toString() {
      return getId();
    }

    /**
     * @return the servicefacilityid
     */
    public String getServiceFacilityID() {
        return servicefacilityid;
    }

    /**
     * @param servicefacilityid the servicefacilityid to set
     */
    public void setServiceFacilityID(String servicefacilityid) {
        this.servicefacilityid = servicefacilityid;
    }

    /**
     * @return the servicefacility
     */
    public ServiceFacility getServiceFacility() throws DataException {
        if(servicefacility == null){
            servicefacility = ServiceFacilityDAO.getInstance().read(this.id);
        }
        return servicefacility;
    }

    /**
     * @param servicefacility the servicefacility to set
     */
    public void setServiceFacility(ServiceFacility servicefacility) {
        this.servicefacility = servicefacility;
    }
}
